Most important parameters specify location and dimension of the object constructed
Ex. new FramedRect ( 10, 10, 40, 60, canvas );
Coordinates follow the rules
Basic unit of measurement is a pixel on the screen
the y coordinate is upside down
Larger = closer to bottom of screen
The origin ( 0, 0 ) is in the upper left of the program's window
NOT upper left of the whole display.
Program's window is called the canvas
Program's window is called the canvas
You have to pass canvas as the last parameter to graphical object constructors.
This Tells the object what window to draw itself in Ex. new Line ( x1, y1 ,x2, y2, canvas );
Text Passed as a parameter
Must be enclosed in double quotes (" ")
Distinguished it from names like canvas
So, canvas is very different from "canvas"
Ex. new Text ( " hello there " , x , y, canvas ) ;
Program's window is called the canvas
You have to pass canvas as the last parameter to graphical object constructors.
This tells the object what window to draw itself in Ex. new Line ( x1, y1, x2, y2, canvas );
Text passed as paremeter
Must be enclosed in double ( " " )
Distinguishes it from names like canvas
So, canvas is very different from "canvas"
Ex. new Text ( " hello there" , x, y , canvas) ;
Ex. new FramedRect ( 10, 10, 40, 60, canvas );
Coordinates follow the rules
- Basic unit of measurement is a pixel on the screen
- the y coordinate is upside down
- The origin ( 0, 0 ) is in the upper left of the program's window
NOT upper left of the whole display.Larger = closer to bottom of screen
Program's window is called the canvas
You have to pass canvas as the last parameter to graphical object constructors.
This Tells the object what window to draw itself in Ex. new Line ( x1, y1 ,x2, y2, canvas );
Must be enclosed in double quotes (" ")
Distinguished it from names like canvas
So, canvas is very different from "canvas"
Ex. new Text ( " hello there " , x , y, canvas ) ;
You have to pass canvas as the last parameter to graphical object constructors.
This tells the object what window to draw itself in Ex. new Line ( x1, y1, x2, y2, canvas );
Must be enclosed in double ( " " )
Distinguishes it from names like canvas
So, canvas is very different from "canvas"
Ex. new Text ( " hello there" , x, y , canvas) ;